<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title>众包登录网</title>
<link rel="stylesheet" type="text/css"
	href="/crowd-sourcing/static/bootstart/css/bootstrap.min.css" />
	
<style> 
body {
	background-image: url(/crowd-sourcing/img/301235.jpg);
	background-size: 100%;                     
}

.form-horizontal {
	margin-top: 250px;
	margin-left: 250px;
}
.form-control{
width:600px;
}
.checkbox{
	margin-left: 100px;
}
.btn-success{
margin-left: 400px;
}
</style>
</head>

<body>
	<form class="form-horizontal">
		<div class="form-group">
			<label for="inputEmail3" class="col-sm-2 control-label">用户名</label>
			<div class="col-sm-10">
				<input type="email" class="form-control" id="inputEmail3" autocomplete="off"
					placeholder="用户名">
			</div>
		</div>
		<div class="form-group">
			<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
			<div class="col-sm-10">
				<input type="password" class="form-control" id="inputPassword3"
					placeholder="密码">
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<div class="checkbox">
					<label> <input type="checkbox" id="test"> 我已经详细阅读并同意<a href="#">众包网协议</a>
					</label>
				</div>
			</div>
		</div>
		<button type="button" class="btn btn-success"  onclick="gou()">登录</button>
		<button type="button" class="btn btn-primary" onclick="window.location.href='register.jsp'">注册</button>
	</form>
	<script src="/crowd-sourcing/static/js/jquery-3.4.1.js"></script>
	<script type="text/javascript">
	function gou(){
		if($("#test").prop("checked")==false){
			alert("请认真阅读协议并打钩");
		}else{
			var input = $(".form-horizontal input");
			//获取用户输入框的值
			var dept = {
				
				"name":input[0].value,
				"pswd":input[1].value
			}
			$.ajax({
				type:"post",
			    url:"gou",
			    data:{
			    	"opo":"dan",
			    	"da" : JSON.stringify(dept)
			    },
			   
			success:function(data){
				
				if (data == "true") {
					window.location.href="hone.jsp"
					var name=input[0].value;
					sessionStorage.setItem("list",name);
				} else {
					alert("登录失败");
				}
			}
			})
		}
		
		
	}
	</script>
</body>

</html>